
pkgname=s-nail
pkgver=14.9.10
pkgrel=2
pkgdesc="Mail processing system and commandline utility for sending email"
arch=('x86_64')
url="https://www.sdaoden.eu/code.html#s-naill"
license=('BSD')
groups=('base')
depends=('openssl' 'krb5' 'libidn')
optdepends=('postfix: for sending mail')
backup=('etc/mail.rc')
conflicts=('mailx')
replaces=('mailx')
provides=('mailx')
source=("https://www.sdaoden.eu/downloads/${pkgname}-${pkgver}.tar.xz")
sha256sums=('a60f465a4d55b556ccd3e922b8053f0b05cb5fbf6a7c16a064f51b6c77cce9c2')

build() {
  cd ${pkgname}-${pkgver}

  make VAL_PREFIX=/usr \
       VAL_SYSCONFDIR=/etc \
       VAL_MAIL=/var/spool/mail \
       VAL_LIBEXECDIR=/usr/lib \
       VAL_SID= VAL_MAILX=mail \
       OPT_AUTOCC=0 \
       config

  make build
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} packager-install

  # For compatibility with the old mailx program
  ln -sf mail ${pkgdir}/usr/bin/mailx
  ln -sf mail ${pkgdir}/usr/bin/nail
  ln -sf mail.1.gz ${pkgdir}/usr/share/man/man1/mailx.1.gz

  install -D -m0644 COPYING ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
}
